/**   
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-12-07 13:44:19  
 * Copyright (c) 2015- joysuch-版权所有     
 */
package com.joysuch.wwyt.bp.controller;

import com.joysuch.wwyt.bp.entity.BpEmergencyContingencyPlan;
import com.joysuch.wwyt.bp.entity.BpEmergencyContingencyPlans;
import com.joysuch.wwyt.bp.enums.RegulationDocumentTypes;
import com.joysuch.wwyt.bp.service.BpEmergencyContingencyPlanService;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.bp.service.BpEmergencyContingencyPlanArchiveService;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 应急消防管理——归档
 */
@RestController
@Api(tags = "应急消防管理")
@RequestMapping("/wwyt/bp-emergency-contingency-plan-archive")
public class BpEmergencyContingencyPlanArchiveController {

    private static final Logger logger = LoggerFactory.getLogger(BpEmergencyContingencyPlanArchiveController.class);

    @Autowired
    private BpEmergencyContingencyPlanArchiveService bpEmergencyContingencyPlanArchiveService;

    @Autowired
    private BpEmergencyContingencyPlanService bpEmergencyContingencyPlanService;

    @RequestMapping("delete")
    public Object delete(Long id) {
        try {
            bpEmergencyContingencyPlanArchiveService.delete(id);
            return ResultBean.success("");
        } catch (Exception e) {
            logger.error("删除失败", e);
            return ResultBean.fail(101, "删除失败");
        }
    }

  /*  *//**
     * 重新编制【归档】
     * @param id    待归档的预案 ID
     *//*
    @RequestMapping("archive")
    public Object archive(Long id) {
        try {

            BpEmergencyContingencyPlan bpEmergencyContingencyPlan = bpEmergencyContingencyPlanService.findById(id);
            if (bpEmergencyContingencyPlan.getState() != RegulationDocumentTypes.AUDIT_PASS.getId()) {
                return ResultBean.fail(102, "预案未审核通过");
            }
            bpEmergencyContingencyPlanArchiveService.archive(id);
            return ResultBean.success("");
        } catch (Exception e) {
            logger.error("重新编制失败", e);
            return ResultBean.fail(101, "重新编制失败");
        }
    }*/


}
